<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 100px;
            height: 100px;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .red{
            background-color: red;
        }

        .aqua{
            background-color: aqua;
        }

        .transition{
            transition: background-color 2s linear;
        }
    </style>
</head>

<body>
    <div id="app">

    </div>
</body>
<script src="js/vue.js"></script>
<script>
    const app = Vue.createApp({
        data() {
            return {
                msg: '动画效果',
                isRed: true,
                isAqua: false
            }
        },
        methods:{
            change(){
                this.isRed = !this.isRed;
                this.isAqua = !this.isAqua;
            }
        },
        template: `
            <div>
                <div class="box transition" :class="{red: isRed, aqua: isAqua}">{{msg}}</div>
                <button @click="change">开始/结束</button>
            </div>
        `
    }).mount("#app");
</script>

</html>